package com.langfeiyes.pattern.template.demo2;

public class PrettyLogicStatisTime extends LogicStatisTime{

    @Override
    protected void statis(Long begin, Long end) {
        long total  = Math.abs((begin - end) );

        long hour = (total % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);

        long min = (total % (1000 * 60 * 60)) / (1000 * 60);

        long sec = (total % (1000 * 60)) / 1000;

        if(hour > 0){
            System.out.println(hour + "时" + min + "分" + sec + "秒");
        }else if (min > 0){
            System.out.println(min + "分" + sec + "秒");
        }else if(sec > 0){
            System.out.println(sec + "秒");
        }else{
            System.out.println("耗时太少，无法统计");
        }
    }
}
